const path = require("node:path");
const destinationName = "dist-browser";
const destionationPath = path.resolve(__dirname, destinationName);

module.exports = [
  {
    entry: "./src/index.ts",
    mode: "production",
    devtool: false,
    resolve: {
      extensions: [".ts", ".tsx", ".js"],
    },
    output: {
      path: destionationPath,
      filename: "hanzi-expression-calculate.global.production.js",
      library: {
        type: "global",
      },
    },
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          use: "ts-loader",
          exclude: /node_modules/,
        },
      ],
    },
  },
  {
    entry: "./src/index.ts",
    mode: "development",
    devtool: false,
    resolve: {
      extensions: [".ts", ".tsx", ".js"],
    },
    output: {
      path: destionationPath,
      filename: "hanzi-expression-calculate.global.js",
      library: {
        type: "global",
      },
    },
    module: {
      rules: [
        {
          test: /\.tsx?$/,
          use: "ts-loader",
          exclude: /node_modules/,
        },
      ],
    },
  },
];
